<?php
/*
 * Created on 10-okt-09
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */

/**
 * Heartbeat filter implementation for cusom filters.
 */
function heartbeat_filter_articles(&$messages, HeartbeatAccess $stream) {
  $filtered_messages = array();
  foreach ($messages as $key => $message) {
  	if ($message->nid > 0) {
  	  $node = node_load($message->nid);
  	  if ($node->type == 'article') {
  	    $filtered_messages[$key] = $message;
  	  }
  	}
  }

  return $filtered_messages;
}

/**
 * Heartbeat filter implementation for cusom filters.
 */
function heartbeat_filter_pages(&$messages, HeartbeatAccess $stream) {
  $filtered_messages = array();
  foreach ($messages as $key => $message) {
    if ($message->nid > 0) {
      $node = node_load($message->nid);
      if ($node->type == 'page') {
        $filtered_messages[$key] = $message;
      }
    }
  }

  return $filtered_messages;
}